<?php

use think\facade\Route;

//miss路由，定义404
Route::miss(function () {
    @header("http/1.1 404 not found");
    @header("status: 404 not found");
    exit();
});

/**
 * 登录
 */
Route::group('login', function () {
    Route::post('check', 'login/check');
    Route::post('signup', 'login/signup');
    Route::get('getCate', 'login/getCate');
    Route::get('getImages', 'login/getImages');
    Route::get('getWeb', 'login/getWeb');
});
/**
 * 课程管理
 */
Route::group('course', function () {
    Route::get('getList', 'course/getList');
    Route::get('getIndexList', 'course/getIndexList');
    Route::get('info', 'course/info');
    Route::get('getDetail', 'course/getDetail');
    Route::post('studyRecord', 'course/studyRecord');
})->middleware('verify');
/**
 * 学习中心列表
 */
Route::group('learn', function () {
    Route::get('getList', 'learn/getList');
    Route::get('info', 'learn/info');
})->middleware('verify');

/**
 * 新闻中心
 */
Route::group('news', function () {
    Route::get('getList', 'news/getList');
    Route::get('info', 'news/info');
})->middleware('verify');
/**
 * 疑难解答
 */
 Route::group('message', function () {
    Route::get('getList', 'message/getList');
    Route::post('save', 'message/save');
})->middleware('verify');
/**
 * 练习
 */
Route::group('practice', function () {
    Route::get('getExam', 'practice/getExam');
    Route::get('getTopic', 'practice/getTopic');
    Route::get('judge', 'practice/judge');
    Route::post('createExam', 'practice/createExam');
    Route::post('submit', 'practice/submit');
})->middleware('verify');
/**
 * 考试
 */
 Route::group('examine', function () {
    Route::get('getList', 'examine/getList');
    Route::get('info', 'examine/info');
    Route::get('getExam', 'examine/getExam');
    Route::get('getTopic', 'examine/getTopic');
    Route::post('startAnswer', 'examine/startAnswer');
    Route::post('submit', 'examine/submit');
})->middleware('verify');
/**
 * 用户管理
 */
Route::group('user', function () {
    Route::get('getUserInfo', 'user/getUserInfo');
    Route::post('edit', 'user/edit');
})->middleware('verify');
/**
 * 定时任务/回调
*/
Route::group('callback', function () {
    Route::get('autoOssBackup', 'callback/autoOssBackup');
});

/**
 * 上传
 */
Route::group('gallery', function () {
    Route::post('/upload', '\addons\Gallery\driver\Gallery@upload');
});
